package tuling;

import org.springframework.aop.support.AopUtils;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.core.BridgeMethodResolver;
import tuling.Introductions.ProgramCalculate;

import java.lang.reflect.Method;

/**
 * Created by xsls on 2019/6/10.
 */
public class TulingMainClass {

    public static void main(String[] args) throws NoSuchMethodException {

    	AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext(MainConfig.class);

        Calculate calculate = (Calculate) ctx.getBean("tulingCalculate");
        // int retVal = calculate.add(2,4);
		calculate.mod(2,4);
		Method mod = TulingCalculate.class.getMethod("add", int.class, int.class);
		Method bridgedMethod = BridgeMethodResolver.findBridgedMethod(mod);
		Method mostSpecificMethod = AopUtils.getMostSpecificMethod(mod, Calculate.class);
		System.out.println(bridgedMethod.toString());
		System.out.println(mostSpecificMethod.toString());
        /*ProgramCalculate calculate = (ProgramCalculate) ctx.getBean("tulingCalculate");
        System.out.println(calculate.toBinary(100));*/
    }
}
